<?php if ($this->dir): ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- layouts require "Standards Mode" rendering, which the 401-strict doctype triggers -->
<html>
<head>
	<title><?php echo $this->dir->getFileName() ?></title>
	<link rel="stylesheet" type="text/css" href="/style/yui/reset.css" />
	<link rel="stylesheet" type="text/css" href="/style/yui/fonts.css" />
	<link rel="stylesheet" type="text/css" href="/style/yui/grids.css" />
	<link rel="stylesheet" type="text/css" href="/style/screen.css" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>

<body id="yahoo-com">
<div id="doc" class="yui-t5">
	<div id="hd">
		<h1><?php echo utf8_encode($this->dir->getFileName()) ?></h1>
	</div>
	<div id="bd">
		<div id="yui-main">
			<div class="yui-b">
				<div class="ListContainer">
					<ul class="List Files">
						<?php foreach ($this->dir->getFiles() as $child): ?>
							<?php $path = $this->urlPath($child->getRelativePathFrom($this->root)); ?>
								<?php 
									switch($child->getExtension()) {
										case 'jpg' :
										case 'png' :
										case 'gif' :
											$thumburl = "/file/thumb$path";
											break;
										default :
											$thumburl = "/images/icons/document.png";
									}
								?>
									<li class="ListItem Thumbed">
									<ul>
										<li class="ItemThumb"><a
											href="<?php echo "/file/view$path" ?>"
											style="background: transparent url(<?php echo $thumburl ?>) no-repeat scroll center; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"></a></li>
										<li class="ItemName"><a
											href="<?php echo "/file/view$path" ?>"><?php echo utf8_encode($child->getFileName()) ?></a></li>
									</ul>
									</li>
						<?php endforeach; ?>
					</ul>
				</div>
			</div>
		</div>
		<div class="yui-b">
			<div class="addForm">
				<form method="post" enctype="multipart/form-data">
					<fieldset>
						<legend>Ajouter un fichier</legend>
						<input type="file" name="file" class="file" size="8"/>
						<input type="submit" value="OK" class="submit"/>
					</fieldset>
				</form>
				<form method="post">
					<fieldset>
						<legend>Créer un dossier</legend>
						<input type="text" name="dirname" class="text"/>
						<input type="submit" value="créer" class="submit"/>
					</fieldset>
				</form>
			</div>
			<div class="folderList">
				<h2>Dossiers</h2>
				<?php if (!$this->isRoot): ?>
					<a href="../"><img src="/images/icons/folder_out.png"/> Dossier parent</a><br/>
				<?php endif; ?>
				<?php foreach ($this->dir->getDirectories() as $child): ?>
					<a href="<?php echo $this->urlPath($child->getFileName()).'/' ?>">
						<?php echo utf8_encode($child->getFileName()) ?>
					</a><br/>
				<?php endforeach; ?>
			</div>
		</div>
	</div>
	<div id="ft">
	</div>
</div>
</body>
</html>
<?php endif; ?>